{strip}

{literal}

<script>

function getAddForm(){
		
	$.ajax({
		type: "GET",
		url: "/pages/add",
		data: {
		},
		success: function(data){
			showPopup(data, 'Add new page', false);
		},
		error: function(xhr, statusText, errorThrown){
			showPopup(xhr.responseText, statusText, false);
		}    
	
	});
}

function getEditForm(pagesId){
		
	$.ajax({
		type: "GET",
		url: "/pages/edit",
		data: {
			pagesId: pagesId
		},
		success: function(data){
			showPopup(data, 'Edit page details', false);
		},
		error: function(xhr, statusText, errorThrown){
			showPopup(xhr.responseText, statusText, false);
		}    
	
	});
}

function deletePage(pagesId){
	if (confirm('Are you sure you want to remove this page?')){
		$.ajax({
			type: "GET",
			url: "/pages/delete",
			data: {
				pagesId: pagesId
			},
			success: function(data){
				//showPopup(data, 'Skinshop activation', false);
				window.location.reload();
			},
			error: function(xhr, statusText, errorThrown){
				showPopup(xhr.responseText, statusText, false);
			}
	
		});
		
	}
	return false;
}

</script>

{/literal}
<!-- content -->
<div id="content">
    <div id="content_left">
		<div>
			<h2>STATIC PAGES</h2>
		</div>

		<div>
			<a class="button_" href="#" onclick="getAddForm();">{$commonLocale->t('ADD NEW')}</a>
		</div>
		<br /><br />
		{assign var=catName value=''}
		{foreach $pages as $p}
			{*if $p->getCategoryName() != $catName}
				<div class="left"><h2 style="color: #619AD1">{$p->getCategoryName()}</h2></div>
				<div class="clear"></div>
				{assign var=catName value=$p->getCategoryName()}
			{/if*}
		<div class="skinworlds_list">
			
			<div class="left" style="width: 625px;">
				<div class="left" style="width: 300px; padding: 0px; margin: 0px;">
					<div class="left" ></div><div class="left"><strong>{$p->getTitle()}</strong></div>
					<div class="clear"> </div>
					<!--<div class="left">TEASER: </div><div class="left">{$p->getTeaser()}</div>
					<div class="clear"> </div>
					<div class="left">STATUS: </div><div class="left">{$p->getStatus()->getStatus()}</div>
					<div class="clear"> </div>-->
				</div>
				<div class="left">
					<!--<div class="sKeywords left" >META TITLE: </div><div class="sKeywords left">{$p->getMetaTitle()}</div>
					<div class="clear"> </div>
					<div class="sKeywords left" >META DESCRIPTION: </div><div class="sKeywords left">{$p->getMetaDescription()}</div>
					<div class="clear"> </div>
					<div class="sKeywords left" >META TAGS: </div><div class="sKeywords left">{$p->getMetaTags()}</div>
					<div class="clear"> </div>-->
					<div class="right">
				
						<div>
							<a href="#" onclick="getEditForm({$p->getId()});" class="button_">EDIT</a>&nbsp;
							<a href="#" onclick="deletePage({$p->getId()});" class="button_">DELETE</a>&nbsp;
							<a href="/page/{$p->getId()}/{$p->getTitle()|escape:all}" class="button_" target="_blank">PREVIEW</a>&nbsp;
						</div>
					</div>
					<div class="clear"> </div>
					
				</div>
			</div>
			<div class="clear"> </div>
			
		</div>
		{/foreach}
		
		
	</div>
	<div id="content_right">
		{if $loggedUser->getIsAdministrator()}
			{include file='admin/menu.tpl'}
		{/if}
	
	</div>
</div>
<!-- end content  -->
{/strip}